package com.trkj.controller;


import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.trkj.pojos.YzrStoreCountDet;
import com.trkj.service.YzrInstockService;
import com.trkj.vo.Result;
import com.trkj.vo.YzrStoreCountDetVo;
import com.trkj.vo.YzrStoreCountVo;

@Controller
public class YzrMedStoreController {

	@Autowired
	private YzrInstockService yzrInstockService;
	
	@RequestMapping("/to_yzrMedStore")
	public String toMedStore(){
		return "yzr_medStore";
	}
	
	@RequestMapping("/to_yzrStorePandian")
	public String toStorePandian(){
		return "yzr_storePanDian";
	}
	//分组查出药库库存
	@RequestMapping("/queryMedStoreGroup_yzr")
	public @ResponseBody Map<String,Object> queryMedStoreGroup(int page, int rows){
		return yzrInstockService.queryMedStoreGroup(page, rows);
	}
	
	//根据药品名模糊查询
	@RequestMapping("/queryMedByName_yzr")
	public @ResponseBody Map<String,Object> queryMedByName(int page, int rows, String medName, String cangku){
		return yzrInstockService.queryMedByName(page, rows, medName, cangku);
	}
	
	//根据仓库名查询仓库中的药品
	@RequestMapping("/queryMedByStore_yzr")
	public @ResponseBody Map<String,Object> queryMedByStore(int page, int rows, String cangku){
		return yzrInstockService.queryMedByStore(page, rows, cangku);
	}
	
	//添加盘点数据到数据库
	@RequestMapping("/addPandianYzr")
	public @ResponseBody Result addPandian(YzrStoreCountDetVo storeVo, String pdrck, String pdr){		
		yzrInstockService.addPandian(storeVo, pdrck, pdr);
		return new Result();
	}
	
	//分页查询盘点信息
	@RequestMapping("/queryAllCountYzr")
	public @ResponseBody Map<String,Object> queryAllCount(int page, int rows){
		return yzrInstockService.queryAllCount(page, rows);
	}
	
	//根据id查找盘点信息
	@RequestMapping("/queryCountByIdYzr")
	public @ResponseBody YzrStoreCountVo queryCountById(String countId){
		return yzrInstockService.queryCountById(countId);
	}
	
	//根据id查找盘点明细信息
	@RequestMapping("/queryCountDetByCountIdYzr")
	public @ResponseBody List<YzrStoreCountDet> queryCountDetByCountId(String countId){
		return yzrInstockService.queryCountDetByCountId(countId);
	}
}
